<!doctype html>
<html xmlns:th="www.thymeleaf.org">
<meta charset="utf-8">
<head th:replace="index::head"></HEAD>
<BODY>
	<header th:replace="index::#ph"></header>
	<!--      导航        -->
	<div style="padding: 3px 8px">
		<span class="layui-breadcrumb">
			<a href="/">作业论坛首页</a>
			<a>
				<cite>修改密码</cite>
			</a>
		</span>
	</div>
	<!--      用户登录表单        -->
	<DIV class="t" style="MARGIN-TOP: 15px" align="center">
		<form class="layui-form layui-main" style="width: 500px">
			<div class="layui-form-item">
				<label class="layui-form-label">原密码：</label>
				<div class="layui-input-block">
					<input v-model="user.pwd" type="password" class="layui-input"
						maxlength="12">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">新密码：</label>
				<div class="layui-input-block">
					<input v-model="user.clsSn" type="password" class="layui-input"
						maxlength="12">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">确认密码：</label>
				<div class="layui-input-block">
					<input v-model="user.head" type="password" class="layui-input"
						maxlength="12">
				</div>
			</div>
			<div class="layui-form-item" th:if="${session?.loginedUser?.email?.isEmpty()}">
				<label class="layui-form-label">邮箱地址：</label>
				<div class="layui-input-block">
					<input v-model="user.email" class="layui-input"
						placeholder="留个邮箱地址帮你找回密码">
				</div>
			</div>
			<div class="layui-form-item">
				<button @click="save" type="button" class="layui-btn">提交</button>
				<button onclick="window.history.back();" type="button"
					class="layui-btn">返回</button>
			</div>
		</form>
	</DIV>
	<script type="text/javascript">
	var v = new Vue({
		el : ".t",
		data : { user: {pwd:"",clsSn:"",head:""} },
		methods : {
			save(){
				let btn = window.event.srcElement;
				layui.jquery(btn).addClass("layui-btn-disabled");
				post("setpwd",usp(this.user),res=>{
					location.href="/";
				})
			}
		}
	})
	layui.element.render();
	</script>
	<!-- 导入页脚 -->
	<footer th:replace="index::footer"></footer>
</BODY>
</HTML>
